# Copyright (c) 2018 Presto Labs Pte. Ltd.
# Author: leon

from coin.exchange.base.kr_rest.feed_base import FeedBase
from coin.exchange.bittrex_v1.kr_rest.product import BittrexProduct
from coin.exchange.bittrex_v1.kr_rest.public_client import BittrexPublicClient


class BittrexV1Feed(FeedBase):
  ProductType = BittrexProduct
  is_price_float = True

  def __init__(self, product):
    FeedBase.__init__(self, product)
    self.pub_client = BittrexPublicClient()

  def query_book(self):
    obj = self.pub_client.query_level_book(self.product)
    self.set_book_data(obj.req_timestamp, obj.res_timestamp, obj.msg)
